<html>
<head><meta charset="utf-8"><title>Self type · t-compiler · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/index.html">t-compiler</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Self.20type.html">Self type</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="167796100"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Self%20type/near/167796100" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Matthew Jasper <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Self.20type.html#167796100">(Jun 10 2019 at 21:00)</a>:</h4>
<p><span class="user-mention" data-user-id="119009">@eddyb</span> regarding <a href="https://github.com/rust-lang/rust/issues/50125" target="_blank" title="https://github.com/rust-lang/rust/issues/50125">#50125</a>, am I right in thinking that you would expect <code>.has_self_ty()</code> to be replaced with something like <code>has_ty_param(0)</code> and <code>TypeFlags::HAS_SELF</code> to be removed without direct replacement?</p>



<a name="167824826"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Self%20type/near/167824826" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Self.20type.html#167824826">(Jun 11 2019 at 07:03)</a>:</h4>
<p>huh, when was <code>HAS_SELF</code> added, that should be removed before <code>has_self_ty</code></p>



<a name="167824883"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Self%20type/near/167824883" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Self.20type.html#167824883">(Jun 11 2019 at 07:04)</a>:</h4>
<p><span class="user-mention" data-user-id="116118">@Matthew Jasper</span> I think in my PR to change how parameters work (which wasn't merged because it was a perf hit to have DefId's in ty::Param) I changed uses to involve a TypeVisitor</p>



<a name="167824900"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Self%20type/near/167824900" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Self.20type.html#167824900">(Jun 11 2019 at 07:05)</a>:</h4>
<p><a href="https://github.com/rust-lang/rust/pull/53661" target="_blank" title="https://github.com/rust-lang/rust/pull/53661">https://github.com/rust-lang/rust/pull/53661</a></p>



<a name="167824922"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Self%20type/near/167824922" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Self.20type.html#167824922">(Jun 11 2019 at 07:05)</a>:</h4>
<p>yeah okay <a href="https://github.com/rust-lang/rust/pull/53661/files#diff-1b4d50b82a87f1031cd5f99b64123de7R594" target="_blank" title="https://github.com/rust-lang/rust/pull/53661/files#diff-1b4d50b82a87f1031cd5f99b64123de7R594">https://github.com/rust-lang/rust/pull/53661/files#diff-1b4d50b82a87f1031cd5f99b64123de7R594</a></p>



<a name="167824974"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Self%20type/near/167824974" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Self.20type.html#167824974">(Jun 11 2019 at 07:06)</a>:</h4>
<p><span class="user-mention" data-user-id="116118">@Matthew Jasper</span> so replace <code>has_self_ty</code> with <code>.walk().any(|ty| ty == self_param_ty)</code> where <code>self_param_ty</code> you obtain with <code>mk_self_type</code> or w/e</p>



<a name="167824998"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Self%20type/near/167824998" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Self.20type.html#167824998">(Jun 11 2019 at 07:07)</a>:</h4>
<p>the reason this is an improvement is because whatever is doing this and using <code>mk_self_type</code> should know already that parameter 0 is <code>Self</code></p>



<a name="167825002"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/Self%20type/near/167825002" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> eddyb <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/Self.20type.html#167825002">(Jun 11 2019 at 07:07)</a>:</h4>
<p>whereas <code>has_self_ty</code> could be expected to used more generally</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>